#!/bin/bash

echo '键值对服务Etcd';
echo '安装etcd服务';
yum install etcd -y;

echo '修改配置';
cp /etc/etcd/etcd.conf{,.bak};

echo '注意更改IP!';
echo 'ETCD_INITIAL_CLUSTER
ETCD_INITIAL_ADVERTISE_PEER_URLS
ETCD_ADVERTISE_CLIENT_URLS
ETCD_LISTEN_CLIENT_URLS
#[Member]
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_PEER_URLS="http://10.71.11.6:2380"
ETCD_LISTEN_CLIENT_URLS="http://10.71.11.6:2379"
ETCD_NAME="controller"
#[Clustering]
ETCD_INITIAL_ADVERTISE_PEER_URLS="http://10.71.11.6:2380"
ETCD_ADVERTISE_CLIENT_URLS="http://10.71.11.6:2379"
ETCD_INITIAL_CLUSTER="controller=http://10.71.11.6:2380"
ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster-01"
ETCD_INITIAL_CLUSTER_STATE="new"'>/etc/etcd/etcd.conf;

echo '设置开机自动启动';
systemctl enable etcd;
systemctl start etcd;
echo '-----------------------------------------------------';
echo '                   etcd 配置完成                     ';
echo '-----------------------------------------------------';
